﻿Imports System.ComponentModel.Composition
Imports System.ComponentModel.Composition.Hosting

Class Application

    ''' <summary>
    ''' Used by MEF to manage catalog of addins and map them to references
    ''' </summary>
    Friend _container As CompositionContainer
    'Friend _catalog As New AggregateCatalog()

    <Import("MainWindow")> _
    Public Shadows Property MainWindow() As Window
        Get
            Return MyBase.MainWindow
        End Get

        Set(ByVal value As Window)
            MyBase.MainWindow = value
        End Set
    End Property

    Protected Overrides Sub OnStartup(ByVal e As System.Windows.StartupEventArgs)
        MyBase.OnStartup(e)

        If (Application.Current.Compose(Me)) Then
            'MainWindow.Show()
        Else
            Shutdown()
        End If
    End Sub

    Public Sub New()

    End Sub

    Protected Overrides Sub OnExit(ByVal e As System.Windows.ExitEventArgs)
        MyBase.OnExit(e)

        If Not _container Is Nothing Then
            _container.Dispose()
        End If
    End Sub
End Class
